package com.chorye.datasource.controller;

import com.chorye.datasource.entity.Student;
import com.chorye.datasource.entity.StudentThird;
import com.chorye.datasource.service.StudentService;
import com.chorye.datasource.service.StudentThirdService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @Company: 北京根网科技有限公司
 * @Author JiangYy
 * @Title: TestController
 * @Description: TODO
 * @Date 2018/12/13 14:56
 */
@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {

    @Autowired
    private StudentService studentService;

    @Autowired
    private StudentThirdService studentThirdService;

    @RequestMapping("/datasource")
    public void testDataSource() {
        Student student = new Student();
        student.setName("Plus测试思密达");
        student.setAge(11);
        student.setMobile("13512323333");
        student.setAddress("五棵松");
        student.setSalary(new BigDecimal(999));
        boolean save = studentService.save(student);
        log.info("保存结果：" + save);
        StudentThird studentThird = studentThirdService.getById(1);
        log.info(studentThird.toString());
    }
}
